﻿<%@ Page Title="Client Management - List View" Language="C#" MasterPageFile="~/admin.master" AutoEventWireup="true" Inherits="MediaMonitor.Admin.Company_Mgmt_List" Codebehind="company-mgmt-list.aspx.cs" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Head" Runat="Server">
    <telerik:radcodeblock id="RadCodeBlock1" runat="server">
        <script src="../rad-scripts/rad.js" type="text/javascript"></script>  
    </telerik:radcodeblock>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Body" Runat="Server">

    <div style="padding: 5px; width: 90%; position: relative;">

     <div style="text-align:left; padding-bottom:3px;">
        <a href="user-mgmt-allpdf.aspx"><b>Send email to all Clients</b></a>
    </div>

    <div style="text-align:right; padding-bottom:3px;">
        <a id="aAddNewClients" runat="server" ><b>Add new Client</b></a>
    </div>
    <telerik:RadAjaxPanel ID="pnlUpdate" runat="server" RestoreOriginalRenderDelegate="false">
    
        <telerik:radgrid id="radGrid" runat="server" allowfilteringbycolumn="True" allowpaging="True"
            allowsorting="True" gridlines="None" skin="Hay" onneeddatasource="radGrid_NeedDataSource"
            width="100%" autogeneratecolumns="false" groupingsettings-casesensitive="false"
            pagesize="15" OnDeleteCommand="radGrid_DeleteCommand" OnPreRender="radGrid_PreRender" >
                <MasterTableView DataKeyNames="CompanyCode" ExpandCollapseColumn-Display="true" GroupLoadMode="Client">
                    <Columns>
                        <telerik:GridButtonColumn Text="Delete" ButtonType="LinkButton" UniqueName="btnDelete" ConfirmText="All users of this company and their records will also be deleted. Are you sure to delete this record?"
                            ConfirmTitle="Delete Confirmation" CommandName="Delete" />

                       <telerik:GridTemplateColumn AllowFiltering="false" >
                            
                            <ItemTemplate>
                            <%if (AppUser.GetUserRoles(AppUser.CurrUserID)[0].ToString() == "advanced user")
                              {%>
                              <a href="javascript:void(0);">Edit</a>&nbsp;<a href='user-mgmt-pdf.aspx?cid=<%#Eval("CompanyCode")%>'>/Pdf</a>&nbsp;<a href='user-mgmt-NewsAlert.aspx?cid=<%#Eval("CompanyCode")%>'>/N&A</a><a href='user-mgmt-pdfNews.aspx?cid=<%#Eval("CompanyCode")%>'>/PdfNews</a>
                            <%} %>
                            <%else
                              { %>
                              <a  href='company-mgmt-addedit.aspx?cid=<%#Eval("CompanyCode")%>'>Edit</a>&nbsp;<a href='user-mgmt-pdf.aspx?cid=<%#Eval("CompanyCode")%>'>/Pdf</a>&nbsp;<a href='user-mgmt-NewsAlert.aspx?cid=<%#Eval("CompanyCode")%>'>/N&A</a><a href='user-mgmt-pdfNews.aspx?cid=<%#Eval("CompanyCode")%>'>/PdfNews</a>
                            <%} %>
                               
                                <hr />
                                <a href='user-mgmt-list.aspx?cid=<%#Eval("CompanyCode")%>'>
                                    Users</a> (<a href='user-mgmt-addedit.aspx?cid=<%#Eval("CompanyCode")%>'><b>+</b></a>)
                                     
                            </ItemTemplate>
                       </telerik:GridTemplateColumn>
                      
                       <telerik:GridImageColumn DataImageUrlFields="Logo" DataImageUrlFormatString="../get-thumb.aspx?f=images/companies/tn/{0}&w=70" HeaderText="Logo" AllowFiltering="false" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="CompanyCode" HeaderText="Code" FilterControlWidth="34" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="CompanyName" HeaderText="Company Name" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="ValidFromDate" HeaderText="Valid From" DataFormatString="{0:d}"
                            FilterControlWidth="50" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="ValidToDate" HeaderText="Valid To" DataFormatString="{0:d}" FilterControlWidth="50" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="Credits" HeaderText="Credits" FilterControlWidth="35" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="Active" HeaderText="Active" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="NoSummary" HeaderText="No Summary" />
                        <telerik:GridBoundColumn  AutoPostBackOnFilter="true" DataField="LastModifiedDate" HeaderText="Last Modified" HtmlEncode="false"
                            DataFormatString="{0:d}" FilterControlWidth="50" />
                    </Columns>
                     
                </MasterTableView>
                <ClientSettings>
                    <Scrolling AllowScroll="false" />
                    <ClientEvents OnFilterMenuShowing="filterMenuShowing" />
                </ClientSettings>
                <FilterMenu OnClientShowing="MenuShowing" />
            </telerik:radgrid>
    
    </telerik:RadAjaxPanel>

    </div>

</asp:Content>

